/*    

    bobbietalk - a visual programming environment for toy robotics

    Copyright (C) 2013  Roberto Tiella

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/
package bobbietalk;

import bobbietalk.gui.MainForm;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author roberto
 */
public class Main {
    
    private Main() {}

    /**
     * @param args the command line arguments
     */
    public static void main(final String [] args) {
        Locale.setDefault(Locale.ITALY);

        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            Utilities.getLogger().log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            Utilities.getLogger().log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            Utilities.getLogger().log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            Utilities.getLogger().log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    //                java.util.Enumeration keys = UIManager.getDefaults().keys();
                    //                while (keys.hasMoreElements()) {
                    //                    Object key = keys.nextElement();
                    //                    Object value = UIManager.get(key);
                    //                    if (value != null && value instanceof javax.swing.plaf.FontUIResource) {
                    //                        System.out.println(key+" "+value);
                    //                    }
                    //                }


                    new MainForm().setVisible(true);
                } catch (Exception ex) {

                    Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "can't start bobbietalk", ex);

                    System.exit(1);

                }
            }
        });
    }
}
